/*
 * Copyright 2005-2013 shopxx.net. All rights reserved.
 * Support: http://www.shopxx.net
 * License: http://www.shopxx.net/license
 */
package com.xiaorong.dao.impl;

import java.util.ArrayList;
import java.util.List;

import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Repository;

import com.xiaorong.Filter;
import com.xiaorong.Filter.Operator;
import com.xiaorong.dao.OrderDao;
import com.xiaorong.entity.Order;

@Repository
public class OrderDaoImpl extends BaseDaoImpl<Order, Long> implements OrderDao {

	@Override
	public boolean isExistSn(String sn, String orderType) {
		if(StringUtils.isBlank(sn)){
			return true;
		}
		List<Filter> filters = new ArrayList<Filter>();
		filters.add(new Filter("sn", Operator.eq, sn.trim()));
		filters.add(new Filter("orderType", Operator.eq, orderType.trim()));
		List<Order> orders = findList(null, null, filters, null);
		if(orders != null && orders.size() > 0){
			
			return true;
		}
		return false;
	}


}